package com.heima.wemedia.controller;


import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmUserDto;
import com.heima.model.wemedia.pojos.WmUser;
import com.heima.wemedia.service.WmUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Api(value = "自媒体用户API",tags = "自媒体用户API")
@RequestMapping("/api/v1/user")
@RestController
public class WmUserController {

    @Autowired
    private WmUserService wmUserService;

    @PostMapping("/save")
    @ApiOperation(value = "保存自媒体用户信息")
    public ResponseResult save(@RequestBody WmUser wmUser) {
        return this.wmUserService.insert(wmUser);
    }

    @ApiOperation("根据名称查询自媒体用户信息")
    @GetMapping("/findByName/{name}")
    public ResponseResult findByName(@PathVariable("name") String name) {
        return this.wmUserService.findByName(name);
    }
}
